#define _CRT_SECURE_NO_WARNINGS 1


#include<iostream>
using namespace std;
const int N = 3000010;
long long n, p, inv[N];
inline int read()
{
    char c = getchar();
    int x = 0;
    int flag = 1;
    while (c < '0' || c>'9')
    {
        if (c == '-')
            flag = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        x = (x * 10 + c - '0');
        c = getchar();
    }
    return x * flag;
}
int main()
{
    n = read();
    p = read();
    inv[1] = 1;
    puts("1");
    for (int i = 2;i <= n;i++)
    {
        inv[i] = (p - p / i) * inv[p % i] % p;
        cout << inv[i] << "\n";
    }
    return 0;
}